/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sadhar.sipp.laporanrkaunit;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.sadhar.errhandler.ClassAntiNull;
import org.sadhar.sia.common.ClassConnection;
import org.sadhar.sia.common.ClassUtility;
import org.springframework.jdbc.core.RowMapper;

/**
 *
 * @author Yohan Hardinugroho
 */
public class LaporanRKAUnitDAOImpl implements LaporanRKAUnitDAO {

    public String tahunKelompokAnggaranYangDigunakan(String tahunAnggaran) {
        String sql = "select tahunKelompok from ppmk.kelompokAnggaranYangDigunakan where tahunAnggaran=?";
        List<Map> lmap = ClassConnection.getJdbc().queryForList(
                sql,
                new Object[]{ClassUtility.quote(tahunAnggaran)});

        String tahunKelompok = "";
        for (Map m : lmap) {
            tahunKelompok = ClassAntiNull.AntiNullString(m.get("tahunKelompok"));
        }

        return tahunKelompok;
    }

    public String getQueryRKA(String tahun, String tahunKelompok, String kodeUnit) {
        String sql = "SELECT Nama_unit_kerja, " +
                "kelompokKegiatan, " +
                "namaSubKegiatan," +
                "jenisKegiatan," +
                "keterangan," +
                "noIndikatorKinerja," +
                "pos.namaPosBiaya as namaPosBiaya1," +
                "pos2.namaPosBiaya as namaPosBiaya2," +
                "namaItem," +
                "harga," +
                "kuantitas," +
                "jumlahHari," +
                "IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN ppmk.itemBiaya AS ib ON rab_rapat.kodeItemBiayaBarang=ib.kodeItem " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='"+kodeUnit+"' and pos2.namaTabelItem='itemBiaya' " +
                "Union ALL " +
                "SELECT Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaBarang,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN asset.hargaBarang as harga on harga.idHargaBarang=rab_rapat.kodeItemBiayaBarang " +
                "inner join asset.barang as item on item.idBarang=harga.idBarang " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='"+kodeUnit+"' and pos2.namaTabelItem='barang' GROUP BY kodeUnit, kelompokKegiatan, namaSubKegiatan ORDER BY Nama_unit_kerja,kelompokKegiatan,namaSubKegiatan,namaPosBiaya1,namaPosBiaya2 ";
        return sql;
    }

    public List<Map> getListQueryRKA(String tahun, String tahunKelompok, String kodeUnit) {
        return ClassConnection.getJdbc().query("SELECT Nama_unit_kerja, " +
                "kelompokKegiatan, " +
                "namaSubKegiatan," +
                "jenisKegiatan," +
                "keterangan," +
                "noIndikatorKinerja," +
                "pos.namaPosBiaya as namaPosBiaya1," +
                "pos2.namaPosBiaya as namaPosBiaya2," +
                "namaItem," +
                "harga," +
                "kuantitas," +
                "jumlahHari," +
                "IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN ppmk.itemBiaya AS ib ON rab_rapat.kodeItemBiayaBarang=ib.kodeItem " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='"+kodeUnit+"' and pos2.namaTabelItem='itemBiaya' " +
                "Union ALL " +
                "SELECT Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaBarang,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN asset.hargaBarang as harga on harga.idHargaBarang=rab_rapat.kodeItemBiayaBarang " +
                "inner join asset.barang as item on item.idBarang=harga.idBarang " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='"+kodeUnit+"' and pos2.namaTabelItem='barang' GROUP BY kodeUnit, kelompokKegiatan, namaSubKegiatan ORDER BY Nama_unit_kerja,kelompokKegiatan,namaSubKegiatan,namaPosBiaya1,namaPosBiaya2 ", new dtView());
    }
    
    public List<Map> getQueryRKA11(String tahun, String tahunKelompok, String kodeUnit)
    {
        return ClassConnection.getJdbc().query("select Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN ppmk.itemBiaya AS ib ON rab_rapat.kodeItemBiayaBarang=ib.kodeItem " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='"+kodeUnit+"' and pos2.namaTabelItem='itemBiaya'  ", new dtView());
    }

    public List<Map> getQueryRKA11All(String tahun, String tahunKelompok)
    {
        return ClassConnection.getJdbc().query("select Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN ppmk.itemBiaya AS ib ON rab_rapat.kodeItemBiayaBarang=ib.kodeItem " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y' and pos2.namaTabelItem='itemBiaya'  ", new dtView());
    }

    protected class dtView implements RowMapper {

        public Object mapRow(ResultSet rs, int arg1) throws SQLException, SQLException {
            LaporanRKAUnit x = new LaporanRKAUnit();
            x.setNama_unit_kerja(rs.getString("Nama_unit_kerja"));
            x.setKelompokKegiatan(rs.getString("kelompokKegiatan"));
            x.setNamaSubKegiatan(rs.getString("namaSubKegiatan"));
            x.setJenisKegiatan(rs.getString("jenisKegiatan"));
            x.setKeterangan(rs.getString("keterangan"));
            x.setNoIndikatorKerja(rs.getString("noIndikatorKinerja"));
            x.setNamaPosBiaya1(rs.getString("namaPosBiaya1"));
            x.setNamaPosBiaya2(rs.getString("namaPosBiaya2"));
            //x.setNamaBarang(rs.getString("namaBarang"));
            x.setNamaItem(rs.getString("namaItem"));
            x.setHarga(rs.getString("harga"));
            x.setKuantitas(rs.getString("kuantitas"));
            x.setJumlahHari(rs.getString("jumlahHari"));
            x.setJumlah(rs.getString("jumlah"));
            return x;
        }
    }

    public String getQueryRKA1(String tahun, String tahunKelompok, String kodeUnit) {
        String sql = "Select Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN ppmk.itemBiaya AS ib ON rab_rapat.kodeItemBiayaBarang=ib.kodeItem " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='"+kodeUnit+"' and pos2.namaTabelItem='itemBiaya' ";
        return sql;
    }

    public String getQueryRKA1All(String tahun, String tahunKelompok) {
        String sql = "SELECT Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN ppmk.itemBiaya AS ib ON rab_rapat.kodeItemBiayaBarang=ib.kodeItem " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND pos2.namaTabelItem='itemBiaya' ";
        return sql;
    }

    public List<Map> getQueryRKA22(String tahun, String tahunKelompok, String kodeUnit)
    {
        return ClassConnection.getJdbc().query("SELECT Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaBarang as namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN asset.hargaBarang as harga on harga.idHargaBarang=rab_rapat.kodeItemBiayaBarang " +
                "inner join asset.barang as item on item.idBarang=harga.idBarang " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='"+kodeUnit+"' and pos2.namaTabelItem='barang'  ", new dtView());
    }

    public List<Map> getQueryRKA22All(String tahun, String tahunKelompok)
    {
        return ClassConnection.getJdbc().query("SELECT Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaBarang as namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN asset.hargaBarang as harga on harga.idHargaBarang=rab_rapat.kodeItemBiayaBarang " +
                "inner join asset.barang as item on item.idBarang=harga.idBarang " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y' and pos2.namaTabelItem='barang'  ", new dtView());
    }

    public String getQueryRKA2(String tahun, String tahunKelompok, String kodeUnit) {
        String sql = "SELECT Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaBarang as namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN asset.hargaBarang as harga on harga.idHargaBarang=rab_rapat.kodeItemBiayaBarang " +
                "inner join asset.barang as item on item.idBarang=harga.idBarang " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y'AND  keg.kodeUnit='" + kodeUnit + "' and pos2.namaTabelItem='barang' ";
        return sql;
    }

    public String getQueryRKA2All(String tahun, String tahunKelompok) {
        String sql = "SELECT Nama_unit_kerja, kelompokKegiatan, namaSubKegiatan,jenisKegiatan,keterangan,noIndikatorKinerja,pos.namaPosBiaya as namaPosBiaya1,pos2.namaPosBiaya as namaPosBiaya2,namaBarang as namaItem,harga,kuantitas,jumlahHari,IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN asset.hargaBarang as harga on harga.idHargaBarang=rab_rapat.kodeItemBiayaBarang " +
                "inner join asset.barang as item on item.idBarang=harga.idBarang " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y' and pos2.namaTabelItem='barang' ";
        return sql;
    }
    
    public List<Map> getListQueryRKAall(String tahun, String tahunKelompok) {
        return ClassConnection.getJdbc().query( "SELECT Nama_unit_kerja, " +
                "kelompokKegiatan, " +
                "namaSubKegiatan," +
                "jenisKegiatan," +
                "keterangan," +
                "noIndikatorKinerja," +
                "pos.namaPosBiaya as namaPosBiaya1," +
                "pos2.namaPosBiaya as namaPosBiaya2," +
                "namaItem," +
                "harga," +
                "kuantitas," +
                "jumlahHari," +
                "IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN ppmk.itemBiaya AS ib ON rab_rapat.kodeItemBiayaBarang=ib.kodeItem " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y' and pos2.namaTabelItem='itemBiaya' " +
                "Union ALL " +
                "SELECT Nama_unit_kerja, " +
                "kelompokKegiatan, " +
                "namaSubKegiatan," +
                "jenisKegiatan," +
                "keterangan," +
                "noIndikatorKinerja," +
                "pos.namaPosBiaya as namaPosBiaya1," +
                "pos2.namaPosBiaya as namaPosBiaya2," +
                "namaBarang as namaItem," +
                "harga," +
                "kuantitas," +
                "jumlahHari," +
                "IF(jumlahHari=0,SUM(harga*kuantitas),SUM(harga*kuantitas*jumlahHari)) as jumlah " +
                "FROM ppmk.kelompokBiaya AS klpk " +
                "INNER JOIN ppmk.subkelompokAnggaranBiaya AS sub ON klpk.kodeKelompokBiaya=sub.kodeKelompokBiaya " +
                "INNER JOIN ppmk.anggaranBiayaRapatKerjaDanKegiatan AS rab_rapat ON rab_rapat.kodePosBiaya=sub.KodePosBiaya " +
                "INNER JOIN ppmk.kegiatanUnit AS keg ON rab_rapat.kodeRapatKerjaSubKegiatan=keg.kodeKegiatanUnit " +
                "INNER JOIN ppmk.kelompokKegiatan AS kelkeg ON keg.kodeKelompokKegiatan=kelkeg.kodeKelompok " +
                "INNER JOIN ppmk.posBiaya AS pos ON pos.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN ppmk.posBiaya AS pos2 ON pos2.kodePosBiaya=rab_rapat.kodePosBiaya " +
                "INNER JOIN asset.hargaBarang as harga on harga.idHargaBarang=rab_rapat.kodeItemBiayaBarang " +
                "inner join asset.barang as item on item.idBarang=harga.idBarang " +
                "INNER JOIN ppmk.jenisKegiatan AS jenkeg ON keg.kodeJenisKegiatan=jenkeg.kodeJenisKegiatan " +
                "INNER JOIN ppmk.jenisBiaya AS jns ON jns.kodeJenisBiaya= klpk.kodeJenisBiaya " +
                "INNER JOIN ppmk.kelompokRKA AS klpkRKA ON klpkRKA.kodeKelompokKegiatan=keg.kodeKelompokKegiatan AND klpkRKA.kodePosBiaya=klpk.kodePosBiaya " +
                "INNER JOIN kamus.unkerja AS un ON un.Kd_unit_kerja=keg.kodeUnit " +
                "WHERE klpk.kodeJenisBiaya='2' AND tahunKelompok='"+tahunKelompok+"' AND keg.tahun='"+tahun+"' AND isRapat='N' AND isRevisi='Y' AND isSudahDiajukan='Y' and pos2.namaTabelItem='barang' GROUP BY kodeUnit, kelompokKegiatan, namaSubKegiatan ORDER BY Nama_unit_kerja,kelompokKegiatan,namaSubKegiatan,namaPosBiaya1,namaPosBiaya2 ", new dtView());
    }

    public LinkedList getFieldCln()
   {
       LinkedList xls = new LinkedList();
       xls.add("Nama_unit_kerja");
       xls.add("kelompokKegiatan");
       xls.add("namaSubKegiatan");
       xls.add("jenisKegiatan");
       xls.add("keterangan");
       xls.add("noIndikatorKinerja");
       xls.add("namaPosBiaya1");
       xls.add("namaPosBiaya2");
       xls.add("namaItem");
       xls.add("harga");
       xls.add("kuantitas");
       xls.add("jumlahHari");
       xls.add("jumlah");
       return xls;
   }

    public Object[][] SetDataToCetak2All(String tahun, String tahunKelompok) throws Exception
    {
         LinkedList xFieldtrmln = getFieldCln();
         List xlstrmln = getQueryRKA22All(tahun,tahunKelompok);
         Object[][] xBufResult = new Object[xlstrmln.size()][xFieldtrmln.size()];
         int i=0;
         for(Iterator it = xlstrmln.iterator(); it.hasNext();)
         {
            LaporanRKAUnit xtrmln = (LaporanRKAUnit) it.next();
            xBufResult[i][0] = xtrmln.getNama_unit_kerja();
            xBufResult[i][1] = xtrmln.getKelompokKegiatan();
            xBufResult[i][2] = xtrmln.getNamaSubKegiatan();
            xBufResult[i][3] = xtrmln.getJenisKegiatan();
            xBufResult[i][4] = xtrmln.getKeterangan();
            xBufResult[i][5] = xtrmln.getNoIndikatorKerja();
            xBufResult[i][6] = xtrmln.getNamaPosBiaya1();
            xBufResult[i][7] = xtrmln.getNamaPosBiaya2();
            xBufResult[i][8] = xtrmln.getNamaItem();
            xBufResult[i][9] = Float.parseFloat(xtrmln.getHarga());
            xBufResult[i][10] = Float.parseFloat(xtrmln.getKuantitas());
            xBufResult[i][11] = Float.parseFloat(xtrmln.getJumlahHari());
            xBufResult[i][12] = Float.parseFloat(xtrmln.getJumlah());
            i++;
        }
         return xBufResult;
    }
    
    public Object[][] SetDataToCetakRKAall(String tahun, String tahunKelompok) throws Exception
    {
         LinkedList xFieldtrmln = getFieldCln();
         List xlstrmln = getListQueryRKAall(tahun,tahunKelompok);
         Object[][] xBufResult = new Object[xlstrmln.size()][xFieldtrmln.size()];
         int i=0;
         for(Iterator it = xlstrmln.iterator(); it.hasNext();)
         {
            LaporanRKAUnit xtrmln = (LaporanRKAUnit) it.next();
            xBufResult[i][0] = xtrmln.getNama_unit_kerja();
            xBufResult[i][1] = xtrmln.getKelompokKegiatan();
            xBufResult[i][2] = xtrmln.getNamaSubKegiatan();
            xBufResult[i][3] = xtrmln.getJenisKegiatan();
            xBufResult[i][4] = xtrmln.getKeterangan();
            xBufResult[i][5] = xtrmln.getNoIndikatorKerja();
            xBufResult[i][6] = xtrmln.getNamaPosBiaya1();
            xBufResult[i][7] = xtrmln.getNamaPosBiaya2();
            xBufResult[i][8] = xtrmln.getNamaItem();
            xBufResult[i][9] = Float.parseFloat(xtrmln.getHarga());
            xBufResult[i][10] = Float.parseFloat(xtrmln.getKuantitas());
            xBufResult[i][11] = Float.parseFloat(xtrmln.getJumlahHari());
            xBufResult[i][12] = Float.parseFloat(xtrmln.getJumlah());
            i++;
        }
         return xBufResult;
    }

    public Object[][] SetDataToCetakRKA2(String tahun, String tahunKelompok, String kodeUnit) throws Exception
    {
         LinkedList xFieldtrmln = getFieldCln();
         List xlstrmln = getQueryRKA22(tahun,tahunKelompok,kodeUnit);
         Object[][] xBufResult = new Object[xlstrmln.size()][xFieldtrmln.size()];
         int i=0;
         for(Iterator it = xlstrmln.iterator(); it.hasNext();)
         {
            LaporanRKAUnit xtrmln = (LaporanRKAUnit) it.next();
            xBufResult[i][0] = xtrmln.getNama_unit_kerja();
            xBufResult[i][1] = xtrmln.getKelompokKegiatan();
            xBufResult[i][2] = xtrmln.getNamaSubKegiatan();
            xBufResult[i][3] = xtrmln.getJenisKegiatan();
            xBufResult[i][4] = xtrmln.getKeterangan();
            xBufResult[i][5] = xtrmln.getNoIndikatorKerja();
            xBufResult[i][6] = xtrmln.getNamaPosBiaya1();
            xBufResult[i][7] = xtrmln.getNamaPosBiaya2();
            xBufResult[i][8] = xtrmln.getNamaItem();
            xBufResult[i][9] = Float.parseFloat(xtrmln.getHarga());
            xBufResult[i][10] = Float.parseFloat(xtrmln.getKuantitas());
            xBufResult[i][11] = Float.parseFloat(xtrmln.getJumlahHari());
            xBufResult[i][12] = Float.parseFloat(xtrmln.getJumlah());
            i++;
        }
         return xBufResult;
    }

    public Object[][] SetDataToCetakRKA(String tahun, String tahunKelompok, String kodeUnit) throws Exception
    {
         LinkedList xFieldtrmln = getFieldCln();
         List xlstrmln = getListQueryRKA(tahun,tahunKelompok,kodeUnit);
         Object[][] xBufResult = new Object[xlstrmln.size()][xFieldtrmln.size()];
         int i=0;
         for(Iterator it = xlstrmln.iterator(); it.hasNext();)
         {
            LaporanRKAUnit xtrmln = (LaporanRKAUnit) it.next();
            xBufResult[i][0] = xtrmln.getNama_unit_kerja();
            xBufResult[i][1] = xtrmln.getKelompokKegiatan();
            xBufResult[i][2] = xtrmln.getNamaSubKegiatan();
            xBufResult[i][3] = xtrmln.getJenisKegiatan();
            xBufResult[i][4] = xtrmln.getKeterangan();
            xBufResult[i][5] = xtrmln.getNoIndikatorKerja();
            xBufResult[i][6] = xtrmln.getNamaPosBiaya1();
            xBufResult[i][7] = xtrmln.getNamaPosBiaya2();
            xBufResult[i][8] = xtrmln.getNamaItem();
            xBufResult[i][9] = Float.parseFloat(xtrmln.getHarga());
            xBufResult[i][10] = Float.parseFloat(xtrmln.getKuantitas());
            xBufResult[i][11] = Float.parseFloat(xtrmln.getJumlahHari());
            xBufResult[i][12] = Float.parseFloat(xtrmln.getJumlah());
            i++;
        }
         return xBufResult;
    }

    public List<Map> getQueryIndiktor(String tahun, String kodeUnit) {
        return ClassConnection.getJdbc().query("SELECT indikatorKinerja " +
                "FROM mutu.capaianIndikator AS mut " +
                "WHERE mut.tahun ='"+tahun+"' AND kodeUnit ='"+kodeUnit+"'", new dtView2());
    }

    public List<Map> getQueryIndiktorAll(String tahun) {
        return ClassConnection.getJdbc().query("SELECT indikatorKinerja " +
                "FROM mutu.capaianIndikator AS mut " +
                "WHERE mut.tahun ='"+tahun+"'", new dtView2());
    }
    
    protected class dtView2 implements RowMapper {

        public Object mapRow(ResultSet rs, int arg1) throws SQLException, SQLException {
            LaporanRKAUnit x = new LaporanRKAUnit();
            x.setNamaIndikatorKerja(rs.getString("indikatorKinerja"));
            return x;
        }
    }

    public LinkedList getFieldCln1()
   {
       LinkedList xls = new LinkedList();
       xls.add("indikatorKinerja");
       return xls;
   }

    public Object[][] SetDataToCetakInd(String tahun, String kodeUnit) throws Exception
    {
         LinkedList xFieldtrmln = getFieldCln1();
         List xlstrmln = getQueryIndiktor(tahun,kodeUnit);
         Object[][] xBufResult = new Object[xlstrmln.size()][xFieldtrmln.size()];
         int i=0;
         for(Iterator it = xlstrmln.iterator(); it.hasNext();)
         {
            LaporanRKAUnit xtrmln = (LaporanRKAUnit) it.next();
            xBufResult[i][0] = xtrmln.getNamaIndikatorKerja();
            i++;
        }
         return xBufResult;
    }
    public Object[][] SetDataToCetakIndAll(String tahun) throws Exception
    {
         LinkedList xFieldtrmln = getFieldCln1();
         List xlstrmln = getQueryIndiktorAll(tahun);
         Object[][] xBufResult = new Object[xlstrmln.size()][xFieldtrmln.size()];
         int i=0;
         for(Iterator it = xlstrmln.iterator(); it.hasNext();)
         {
            LaporanRKAUnit xtrmln = (LaporanRKAUnit) it.next();
            xBufResult[i][0] = xtrmln.getNamaIndikatorKerja();
            i++;
        }
         return xBufResult;
    }
}
